package cate.game.admin;

import cate.game.GameBody;
import cate.game.admin.menu.AdminMenuRunnable;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "管理员菜单")
public class AdminMenu {
    @NoteField(value = "游戏主体")
    @JsonIgnore
    public GameBody gameBody;

    @NoteField(value = "菜单名")
    public String name;

    @NoteField(value = "菜单指令")
    public String cmd;

    @NoteField(value = "菜单参数数量")
    public int paramNum;

    @NoteField(value = "菜单描述")
    public String description;

    @NoteField(value = "分类")
    public String type;

    public AdminMenu() {}

    public AdminMenu(String name, String cmd, int paramNum, String description, String type) {
        this.name = name;
        this.cmd = cmd;
        this.paramNum = paramNum;
        this.description = description;
        this.type = type;
    }

    public AdminMenu(GameBody gameBody, String name, int paramNum, String description, String type) {
        this.name = name;
        this.cmd = "" + type + "-" + name;
        this.paramNum = paramNum;
        this.description = description;
        this.type = type;
        gameBody.admin.register(this);
    }

    @JsonIgnore
    private AdminMenuRunnable runnable;

    public void setRunnable(AdminMenuRunnable runnable) {
        this.runnable = runnable;
    }

    public AdminMenuRunnable getRunnable() {
        return this.runnable;
    }
}
